﻿using System;
using static System.Console;

class Program
{
    static void Main()
    {
        WriteLine("hello world");
        WriteLine(whenCrossingRoad(TracfficLight.Red));
    }
    static TracfficLight whenCrossingRoad(TracfficLight light)
    {
        light switch
        {
            TracfficLight.Red => TracfficLight.Amber,
            TracfficLight.Amber => TracfficLight.Green,
            TracfficLight.Green => TracfficLight.Red,
            //用于匹配所有未明确指定的值
            _ => throw new InvalidOperationException()
        };
    }
    internal enum TracfficLight
    {
        Red,
        Amber = 3,
        Green
    }
}
